<template>
  <div class="like">
    <div class="like_shop">
      <div class="shop_title" v-for="(c,i) in items" :key="i">
        <div class="shop_img">
          <img :src="c.img" alt />
          <div class="shop_btn" @click="showDetail(c)">
            <img src="../../public/btn.png" alt />
          </div>
        </div>

        <div>
          <div class="shop_desc">
            <p v-show="$route.meta.hideShopDesc">{{ c.title }}</p>
            <div class="shop_tag" v-for="(v,i) in c.props" :key="i" v-show="$route.meta.hideShopTag">
              <span>{{ v }}</span>
            </div>
          </div>
          <div class="shop_price">
            <span class="shop_money">￥{{ c.price }}</span>
            <span class="shop_like">
              {{ c.cfav }}
              <i class="icon iconfont icon-like"></i>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    items: {
      // type: Array,
      default: () => {
        return [];
      }
    }
  },
  methods:{
    showDetail(c){
      c.link = c.link.split("?",2)[1].split("=",2)[1].split("&", 1)[0]
      this.$router.push({
        path:'/detail',
        query:{
            link:c.link,
            title:c.title,                   
            }
              
      });
      localStorage.setItem('items',JSON.stringify(c));
    }
  }
};
</script>
<style lang="less" scoped>
.like {
  .like_shop {
    width: 100%;
    height:100%;
    // height:270px;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;

    .shop_title {
      width: 48%;
      // height: 700px;

      // border:1px solid red;
      box-sizing: border-box;
      overflow: hidden;
      position: relative;

      .shop_img {
        width:100%;
        height:75%;
        position: relative;
        border-radius: 20px;
        overflow: hidden;
        object-fit: contain;
        object-position: center;
        img {
          width: 100%;
          height:100%;
        }
        .shop_btn {
          position: absolute;
          bottom: 30px;
          right: 30px;
          width: 100px;
        }
      }
    }
    .shop_desc {
      padding: 10px;
      height: 80px;
      font-size: 16px;
      color: #515271;
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      text-overflow: ellipsis;
      display: flex;
      flex-wrap: wrap;
      p {
        text-indent: 2em;
      }
      .shop_tag {
        background-color: #d8e4ea;
        height: 30px;
        // overflow：hidden;
        font-size: 16px;
        color: #7c8d96;
        width: fit-content;
        width: -webkit-fit-content;
        width: -moz-fit-content;
        margin-right: 20px;
        margin-top: 5px;
      }
    }
    .shop_price {
      widows: 100%;
      height: 50px;
      line-height: 50px;
      // font-size: 16px;
      display: flex;
      justify-content: space-between;
      .shop_money {
        font-size: 35px;
        font-weight: bold;
      }
      .shop_like {
        font-size: 14px;
        color: #999;
      }
    }
  }
}
</style>